<%= page do %>
  <%= page_header do %>
    <%= page_header_back(solidus_admin.users_path) %>
    <%= page_header_title(t(".title", email: @user.email)) %>

    <%= page_header_actions do %>
      <%= render component("ui/button").new(tag: :a, text: t(".create_order_for_user"), href: spree.new_admin_order_path(user_id: @user.id)) %>
    <% end %>
  <% end %>

  <%= page_header do %>
    <%= render component("users/edit/tabs").new(user: @user, current: :addresses) %>
  <% end %>

  <%= page_with_sidebar do %>
    <%= page_with_sidebar_main do %>
      <%= render component('ui/panel').new(title: t(".billing_address")) do %>
        <%= form_for @user, url: solidus_admin.update_addresses_user_path(@user), method: :put, html: { id: "#{form_id}_billing", autocomplete: "off", class: "bill_address" } do |f| %>

          <%= render component('ui/forms/address').new(addressable: @bill_address, form_field_name: "user[bill_address_attributes]") %>
          <div class="py-1.5 text-center">
            <%= render component("ui/button").new(tag: :button, text: t(".update"), form: "#{form_id}_billing") %>
            <%= render component("ui/button").new(tag: :a, text: t(".cancel"), href: solidus_admin.addresses_user_path(@user), scheme: :secondary) %>
          </div>
        <% end %>
      <% end %>

      <%= render component('ui/panel').new(title: t(".shipping_address")) do %>
        <%= form_for @user, url: solidus_admin.update_addresses_user_path(@user), method: :put, html: { id: "#{form_id}_shipping", autocomplete: "off", class: "ship_address"  } do |f| %>

          <%= render component('ui/forms/address').new(addressable: @ship_address, form_field_name: "user[ship_address_attributes]") %>
          <div class="py-1.5 text-center">
            <%= render component("ui/button").new(tag: :button, text: t(".update"), form: "#{form_id}_shipping") %>
            <%= render component("ui/button").new(tag: :a, text: t(".cancel"), href: solidus_admin.addresses_user_path(@user), scheme: :secondary) %>
          </div>
        <% end %>
      <% end %>
    <% end %>

    <%= page_with_sidebar_aside do %>
      <%= render component("users/stats").new(user: @user) %>
    <% end %>
  <% end %>
<% end %>
